UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vSbRAGSWE80v/4kHIV0HjRy3BYBD0OtprDjXp4js0zg='
WHERE
key_id = 'c54e7356b88a5a30948870f4ff839347d208890f33d4f84c25f428426236ef43'
AND (
token = 'vSbRAGSWE80v/4kHIV0HjRy3BYBD0OtprDjXp4js0zg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)