UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BjQ+VIXzpGQIl/bGPbg73IvcG4OIzXqVRTo7tLTdrVs=' 
WHERE 
  key_id = 'a0dcb39c3a87d605bd6d060c066b64d5643dc3a2debf8b99a1e55643d5adf70d' 
  AND (
    token = 'BjQ+VIXzpGQIl/bGPbg73IvcG4OIzXqVRTo7tLTdrVs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032