UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tiEO6x566oB0bay4UiSQ3MSIDWj1CCfEn1OertKb5kE='
WHERE
key_id = 'd0dd1f6e7edd927b6fb6a3b5de655096f5b5cfc75ad25789c4d399d2361256a2'
AND (
token = 'tiEO6x566oB0bay4UiSQ3MSIDWj1CCfEn1OertKb5kE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)