UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ronr4F0+mJkEsnPAHpdXnWcNAmUsV0gIGwrA3dItzkM='
WHERE
key_id = 'b7008dca752041c3b2636cebdb7aa6e59681b45df55132ff56a01c674926cb3a'
AND (
token = 'Ronr4F0+mJkEsnPAHpdXnWcNAmUsV0gIGwrA3dItzkM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)