UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h7+Rlyan2pyUyBuz9/wn89/Omi15Jo/FtONhqrmaN8Y='
WHERE
key_id = 'c1862a3f21f40c7438cea95aff93fc7f66897e2a7f927aa69636c8d94f39443f'
AND (
token = 'h7+Rlyan2pyUyBuz9/wn89/Omi15Jo/FtONhqrmaN8Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)