UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nRiYBG6gQkCZAaAj7/QgcV/Tp61XXgXlwQ2bBXHdW1k=' 
WHERE 
  key_id = '4a7bbfcb26ff7014364ba303176c8a728931e3fbc97b0d3696744c14219a167b' 
  AND (
    token = 'nRiYBG6gQkCZAaAj7/QgcV/Tp61XXgXlwQ2bBXHdW1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037