UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BpufMFVGMB1MrMaLATuZM0oFi4C3V+yfI3EnagIN8R0='
WHERE
key_id = '48677516fd0fc085370a54158b6c3613f64185fc1bf463e5d7c52e9b562c923d'
AND (
token = 'BpufMFVGMB1MrMaLATuZM0oFi4C3V+yfI3EnagIN8R0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)