UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dl5zFGb5qJfkjntluLqaXooEM2upHbRhFrdAToRDMgk=' 
WHERE 
  key_id = '6bc8541c855d57949e5fb145b24b16452c6a9c58abe66526664aa831bce82548' 
  AND (
    token = 'dl5zFGb5qJfkjntluLqaXooEM2upHbRhFrdAToRDMgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041