UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0VadKTfJF5Iij8WUKOboc27PcW5abizq69bi/44HLgs=' 
WHERE 
  key_id = 'dec31cab4988db560fa28dd24414b80e1bbc60987e92f491bc8471dd3e10a778' 
  AND (
    token = '0VadKTfJF5Iij8WUKOboc27PcW5abizq69bi/44HLgs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024