UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/YZuWUtmzesK8vdpLiFWxW4VqSU0tvCrtN9hJXpodE4='
WHERE
key_id = 'c365b55337b592d2e07020e466a794feb3189142cd569a11fa435f8c9a64a5c6'
AND (
token = '/YZuWUtmzesK8vdpLiFWxW4VqSU0tvCrtN9hJXpodE4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)