UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qS9MSOyCI26XrIOde+F47zSWIO3gWYkj9G75p/WKN48=' 
WHERE 
  key_id = 'b23ce3ab99ea122e961911e89c6375c33a8c3e1ab5ad96e99e60ec0e215b1a88' 
  AND (
    token = 'qS9MSOyCI26XrIOde+F47zSWIO3gWYkj9G75p/WKN48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038