UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h3g4cbwp8jUStKvWLvTb1m6FIze3UwqO8quOLwsPN/E=' 
WHERE 
  key_id = '6de930448b65158819923b58c2b516626b09aecb7468bf0bc6a698e401468345' 
  AND (
    token = 'h3g4cbwp8jUStKvWLvTb1m6FIze3UwqO8quOLwsPN/E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027