UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Lv1dCdZxZVVa5+LFmM7YIrCIlP4fuQuzHntuAlMGtSc='
WHERE
key_id = '322d7426164c99bbc322ee6cccf5da9bd8131361f8b063f3464a2130037d52cc'
AND (
token = 'Lv1dCdZxZVVa5+LFmM7YIrCIlP4fuQuzHntuAlMGtSc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)