UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l3GxtCNLN7j0a1BY08q6lkslcpyjKtLvSPuAdt28zcM='
WHERE
key_id = '295e7a6c1c0851abc83463ec97e847754ae85663f8766abfbb220f1a83414cf1'
AND (
token = 'l3GxtCNLN7j0a1BY08q6lkslcpyjKtLvSPuAdt28zcM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)