UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Jj3yR0ZhEOBmKrncsPnmOm/8xyd8RtwLiL30+VTNu0U='
WHERE
key_id = 'e6d34a7da9b80da43910c3f27008f049d66380bccf793e31ca9f607e7666e2b0'
AND (
token = 'Jj3yR0ZhEOBmKrncsPnmOm/8xyd8RtwLiL30+VTNu0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)