UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W04eJkmSdUpeDCo5El/gczNbD3UQpMPbSTZ5oo+no2E=' 
WHERE 
  key_id = '54ee529dc541cdae204762b4d77847f37980b40067ca268882f4e3ed736d8f61' 
  AND (
    token = 'W04eJkmSdUpeDCo5El/gczNbD3UQpMPbSTZ5oo+no2E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031