UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7cWSpKVWZbd3l5R3ILMybjMIssd8HlVDn4Afx1aUKjI='
WHERE
key_id = 'd88d8d6701dc1c3795d4433c2847d54504275c4459dae2a97b83db1b1cda71f2'
AND (
token = '7cWSpKVWZbd3l5R3ILMybjMIssd8HlVDn4Afx1aUKjI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)