UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ksVrehUz0dxL5w2YztZByj+Cml9pn6yPHSesUy21zu8=' 
WHERE 
  key_id = 'c0f6f14869c38a064d1b7b873b7c834ef4675607fa5a01010090af653fd21e1b' 
  AND (
    token = 'ksVrehUz0dxL5w2YztZByj+Cml9pn6yPHSesUy21zu8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051