UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1CRvqlLeqo8gQzangvhjmiXqiqNf1BGZvczATYhmAbU=' 
WHERE 
  key_id = '1e7e10f09a46520a1f90072fcf3f6031a4cd89df57438646f0f9667c7082ac86' 
  AND (
    token = '1CRvqlLeqo8gQzangvhjmiXqiqNf1BGZvczATYhmAbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031