UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oJrj/uUUtu6W3QKU2HAphmZZfdbbo6itPTbbgXADflQ=' 
WHERE 
  key_id = '743ac7f10c95c027da30449744299a31458cb42918398b183cbc76aa2f89bd38' 
  AND (
    token = 'oJrj/uUUtu6W3QKU2HAphmZZfdbbo6itPTbbgXADflQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051