UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6hWfPvayW6KAPppArSvDe+2mqOyO7aG0Wg9tA0lZm1o='
WHERE
key_id = '9a8f4a8dc5f3736ab1a0c8c0a212ac96986a87e1c327e992cd7ce1478147681b'
AND (
token = '6hWfPvayW6KAPppArSvDe+2mqOyO7aG0Wg9tA0lZm1o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)