UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P6SW7XmD95U8f37+qyeeHy7oxuc/uNZUOWwwJxYP5ek='
WHERE
key_id = '8cd6c7a66e131d7680fe4e5285354e09977f5bebfd35f3c1f98ba8d7aa0ae1c9'
AND (
token = 'P6SW7XmD95U8f37+qyeeHy7oxuc/uNZUOWwwJxYP5ek='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)