UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cGLjkjethFivi4GXGEd4+R5nH343NyOg7jIXEDaesF8='
WHERE
key_id = 'eac97b8a5869f4aa90616d6556be8aa76bebfc0945dc71380c1142e429d1c67c'
AND (
token = 'cGLjkjethFivi4GXGEd4+R5nH343NyOg7jIXEDaesF8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)