UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OBDPrXJWt6QmsKXFUiumZGAgAa+ISoTQJOI+UP0JGtY='
WHERE
key_id = 'b8319504d894baa86a6991dc3d5b04a387b0ecf9d7ad84e253f4a871b83552f0'
AND (
token = 'OBDPrXJWt6QmsKXFUiumZGAgAa+ISoTQJOI+UP0JGtY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)