UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f5NgjyvJq5H/G4gfQAgdBguBORvZGpppz6+zFy8yAGQ='
WHERE
key_id = 'd9fa1389aee314aaa862863edd45e9e14828eaa8b7c73222aacdfbaf6ed9a6b4'
AND (
token = 'f5NgjyvJq5H/G4gfQAgdBguBORvZGpppz6+zFy8yAGQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)