UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zfFyFThvJUZzSxpaX+rkVvZy57pYiecXSU6B+SC6/mE='
WHERE
key_id = '3ad03462eac086a028bf65a7451371a0a56f0f6a5d96a6abb8d8fe4591791548'
AND (
token = 'zfFyFThvJUZzSxpaX+rkVvZy57pYiecXSU6B+SC6/mE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)