UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iwEZyVDsKPkHHfKpPB85McMehKCL4At9i1i169xRHZ4=' 
WHERE 
  key_id = '961f7f398cb6455e15cace92bc47128e4f760964a51223a344a28cee240043b6' 
  AND (
    token = 'iwEZyVDsKPkHHfKpPB85McMehKCL4At9i1i169xRHZ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042