UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BrCJvuPur8BWeFmlWi4UUQQSCy4SdHKFx0NQlfT6w6w='
WHERE
key_id = 'de3a05c529bbcafbfddaf2e6e7280d524b58fcfa45714f823a88fe64976904d0'
AND (
token = 'BrCJvuPur8BWeFmlWi4UUQQSCy4SdHKFx0NQlfT6w6w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)