UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ns+nNfeMcICpHP+k8/bMjr9VnzbcLiqeeoYs22t9wds=' 
WHERE 
  key_id = 'afd67917110e93d3caebcd6a264d4f127be867619a61a0d370450f245a34e9cd' 
  AND (
    token = 'Ns+nNfeMcICpHP+k8/bMjr9VnzbcLiqeeoYs22t9wds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046