UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uav3YZCZVNY0Lv31Zy23B3BqBa82oe4jrauruloIFhk=' 
WHERE 
  key_id = 'ce556d63528df5ff11589684a56d826663e3483cff10650ef166c5d9283d2913' 
  AND (
    token = 'uav3YZCZVNY0Lv31Zy23B3BqBa82oe4jrauruloIFhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019