UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h8aJ1YtMwBkWZXZtLGZjOQHfaNIvhsA1KvBIQ3l7bVI='
WHERE
key_id = '0bd4f8f5a54ba4f436d0bc04206b2bac21bf7d730bc0e6de9c0cbff1e29b99a8'
AND (
token = 'h8aJ1YtMwBkWZXZtLGZjOQHfaNIvhsA1KvBIQ3l7bVI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)