UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bfR4H26656ka6GeQMGiMOMQ37jw81vsWLo9W2o+EpkM=' 
WHERE 
  key_id = '065a8d8f0ef5728ecd9e20a5d00831695d244c4af6d65f41ca6135b931e839e9' 
  AND (
    token = 'bfR4H26656ka6GeQMGiMOMQ37jw81vsWLo9W2o+EpkM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034