UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hBNEChy0R5vMLTSNVUC11buiaSMkBp33gOuJ6fUa77U='
WHERE
key_id = '24fd3b895649b701d50f94192fe47df3b87d1c3f738f714c8d8407ccdaa7527c'
AND (
token = 'hBNEChy0R5vMLTSNVUC11buiaSMkBp33gOuJ6fUa77U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)